#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
int main()
{
    pid_t id = fork();
    if(id == 0)
    {   
        sleep(1);
        //execl("/usr/bin/ls","ls","-a","-l","--color=auto",NULL);
        //execlp("ls","ls","-a","-l","--color=auto",NULL);
        char* argv[] = 
        {
            "ls",
            "-a",
            "-l",
            "--color=auto",
            NULL
        };
        //execv("/usr/bin/ls",argv);
        //execvp("ls",argv);
        //execl("./ppro",NULL);
        char* envp_[] = {
            (char*)"MY_VAL=11223344",
            NULL
        };
        //execle("./ppro","ppro",NULL,envp_);
        extern char** environ;
        putenv((char*)"MY_VAL=11223344");
        execle("./ppro","ppro",NULL,environ);
        exit(10);
    }
    
    int status = 0;
    pid_t ret = waitpid(id, &status, 0);
    if(ret>0)
    {
        printf("wait success, exit code  = %d, sig code = %d\n",(status>>8)&0xFF,status&0x7F);
    }
    return 0;
}
